package com.kujie.access.controller;

import com.kujie.access.domain.po.AccessEnterpriseRentalInformation;
import com.kujie.access.domain.vo.*;
import com.kujie.access.service.IHomePageService;
import com.kujie.common.core.domain.R;
import com.kujie.common.encrypt.annotation.ApiEncrypt;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 首页 api
 *
 * @author check
 * @date 2025-05-27
 */
@Slf4j
@RestController
@RequestMapping("/home")
@RequiredArgsConstructor
@ApiEncrypt(response = true)
public class HomePageController {
    private final IHomePageService iHomePageService;

    @GetMapping("/rental/situation")
    public R<RentalSituationVO> rentalSituation(String indexCode) {
        return R.ok(iHomePageService.rentalSituation(indexCode));
    }

    @GetMapping("/financial/indicators")
    public R<FinancialIndicatorsVO> financialIndicators() {
        return R.ok(iHomePageService.financialIndicators());
    }

    @GetMapping("/tenant")
    public R<TenantAnalysisVO> tenant() {
        return R.ok(iHomePageService.tenant());
    }

    @GetMapping("/customer/dynamics")
    public R<CustomerDynamicsVO> customerDynamics() {
        return R.ok(iHomePageService.customerDynamics());
    }

    @GetMapping("/contract/manage")
    public R<ContractManageVO> contractManage() {
        return R.ok(iHomePageService.contractManage());
    }

    @GetMapping("/property/situation")
    public R<PropertyListSituationVO> propertySituation() {
        return R.ok(iHomePageService.propertySituation());
    }

    /**
     * 逾期统计
     */
    @GetMapping("/overdue/statistics")
    public R<List<OverdueStatisticsVO>> overdueStatistics() {
        return R.ok(iHomePageService.overdueStatistics());
    }

    /**
     * 租赁到期预警
     */
    @GetMapping("/lease/expiration/warn")
    public R<LeaseExpirationWarnVO> leaseExpirationWarn(String code) {
        return R.ok(iHomePageService.leaseExpirationWarn(code));
    }
}
